<template>
  <!-- 反馈处理 -->
  <div class="feedBackDetail">
    <el-card shadow="never" style="margin-top: 30px">
      <div class="header">
        <div class="page-header">
          <el-page-header @back="goBack" content="处理反馈" style="margin-bottom: 20px">
          </el-page-header>
        </div>
      </div>
      <div class="feedbackTable">
        <el-form :model="feedbackTable"  ref="feedbackTable" label-width="120px" class="demo-ruleForm" size="mini">
          <el-form-item  label="用户名称" prop="userName">
            <el-input  v-model="feedbackTable.user.userName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="电话号码" prop="userPhone">
            <el-input v-model="feedbackTable.user.userPhone" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="反馈问题" prop="feedQuestion">
            <el-input v-model="feedbackTable.feedQuestion" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="反馈描述" prop="feedDescription">
            <el-input type="textarea"
                      v-model="feedbackTable.feedDescription"
                      :rows="5" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="回   复" prop="replyContent">
            <el-input type="textarea"
                      v-model="feedReplyTable.replyContent"
                      :rows="5"></el-input>
          </el-form-item>


          <el-form-item>
            <el-button type="primary" @click="addFeedReply">立即修改</el-button>
          </el-form-item>
        </el-form>
      </div>



    </el-card>
  </div>
</template>

<script>
import {addFeedbackReply, getFeedbackById} from "@/api/allApi";

export default {
  name: "FeedBackDetail",
  data() {
    return {
      admin:'',
      feedbackTable:{},
      feedReplyTable:{},
    }
  },
  created() {
    this.admin = JSON.parse(window.localStorage.getItem('access-admin'))
  },
  methods:{
    goBack() {
      this.$router.back();
    },
    addFeedReply(){
      this.feedReplyTable.feedId = this.feedbackTable.feedId
      this.feedReplyTable.adminId = this.admin.adminId
      addFeedbackReply(this.feedReplyTable).then(res=>{
        if (res.data.success) {

          this.$message.success(res.data.data)
          this.$router.push({
            path: "/adminLayout/adminBackground/pendingFeedback",
          });
        }else {
          this.$message.error(res.data.data)
        }
      })
    },
    getFeedbackById(){
      getFeedbackById(this.$route.params.feedId).then(res=>{
        this.feedbackTable = res.data.data
      })
    }
  },
  mounted() {
    this.getFeedbackById()
  }
}
</script>

<style scoped>

</style>